<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Dynamic Mapping | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'dynamic-mapping.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/dynamic-mapping.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/dynamic-mapping.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/dynamic-mapping.html" rel="nofollow" target="_blank">../en/dynamic-mapping.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="mapping.html">Mapping</a></span>
»
<span class="breadcrumb-node">Dynamic Mapping</span>
</div>
<div class="navheader">
<span class="prev">
<a href="term-vector.html">« <code class="literal">term_vector</code></a>
</span>
<span class="next">
<a href="dynamic-field-mapping.html">Dynamic field mapping »</a>
</span>
</div>
<div class="chapter">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="dynamic-mapping"></a>Dynamic Mapping<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/mapping/dynamic-mapping.asciidoc">edit</a>
</h2>
</div></div></div>
<p>One of the most important features of Elasticsearch is that it tries to get
out of your way and let you start exploring your data as quickly as possible.
To index a document, you don’t have to first create an index, define a mapping
type, and define your fields — you can just index a document and the index,
type, and fields will spring to life automatically:</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT data/_doc/1 <a id="CO360-1"></a><i class="conum" data-value="1"></i>
{ "count": 5 }</pre>
</div>
<div class="console_widget" data-snippet="snippets/782.console"></div>
<div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td align="left" valign="top" width="5%">
<p><a href="#CO360-1"><i class="conum" data-value="1"></i></a></p>
</td>
<td align="left" valign="top">
<p>Creates the <code class="literal">data</code> index, the <code class="literal">_doc</code> mapping type, and a field
called <code class="literal">count</code> with datatype <code class="literal">long</code>.</p>
</td>
</tr>
</table>
</div>
<p>The automatic detection and addition of new fields is called
<em>dynamic mapping</em>. The dynamic mapping rules can be customised to suit your
purposes with:</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<a class="xref" href="dynamic-field-mapping.html" title="Dynamic field mapping">Dynamic field mappings</a>
</span>
</dt>
<dd>
The rules governing dynamic field detection.
</dd>
<dt>
<span class="term">
<a class="xref" href="dynamic-templates.html" title="Dynamic templates">Dynamic templates</a>
</span>
</dt>
<dd>
Custom rules to configure the mapping for dynamically added fields.
</dd>
</dl>
</div>
<div class="tip admon">
<div class="icon"></div>
<div class="admon_content">
<p><a class="xref" href="indices-templates.html" title="Put index template API">Index templates</a> allow you to configure the default
mappings, settings and aliases for new indices, whether created
automatically or explicitly.</p>
</div>
</div>


</div>
<div class="navfooter">
<span class="prev">
<a href="term-vector.html">« <code class="literal">term_vector</code></a>
</span>
<span class="next">
<a href="dynamic-field-mapping.html">Dynamic field mapping »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>